package com.probiz.estore.common.model.customer.base;

import java.io.Serializable;
import java.util.HashSet;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import com.probiz.estore.common.model.attribute.CustomerAttrValue;
import com.probiz.estore.common.model.customer.Customer;
import com.probiz.estore.common.model.customer.ShopPoint;
import com.probiz.estore.common.model.system.AppUser;

/**
 * Customer Base Java Bean, base class for the model, mapped directly to database table
 * 
 * Avoid changing this file if not necessary, will be overwritten. 
 *
 */
public class CustomerTbl extends AppUser implements Serializable {

	private static final long	serialVersionUID	= -1225397468694675773L;
	
	protected String passwordHint;
	protected String passwordHintAnswer;
	protected String note;
	protected String customerCode;
	protected String tags;
	protected String remoteIp;
	protected String address;
	protected ShopPoint shopPoint;
	private java.util.Set<CustomerAttrValue> customerAttrValues = new HashSet<CustomerAttrValue>();


	/**
	 * Default Empty Constructor for class Customer
	 */
	public CustomerTbl () {
		super();
	}
	
	/**
	 * Default Key Fields Constructor for class Customer
	 */
	public CustomerTbl (
		 Integer in_customerId
        ) {
		this.setCustomerId(in_customerId);
    }


	/**
	 * @return Integer
     * @hibernate.id column="customerId" type="java.lang.Integer" generator-class="native"
	 */
	public Integer getCustomerId() {
		return this.appuserId;
	}
	
	/**
	 * Set the customerId
	 */	
	public void setCustomerId(Integer aValue) {
		this.appuserId = aValue;
	}	


	/**
	 * @return String
	 * @hibernate.property column="passwordHint" type="java.lang.String" length="128" not-null="false" unique="false"
	 */
	public String getPasswordHint() {
		return this.passwordHint;
	}
	
	/**
	 * Set the passwordHint
	 */	
	public void setPasswordHint(String aValue) {
		this.passwordHint = aValue;
	}	

	/**
	 * @return String
	 * @hibernate.property column="passwordHintAnswer" type="java.lang.String" length="255" not-null="false" unique="false"
	 */
	public String getPasswordHintAnswer() {
		return this.passwordHintAnswer;
	}
	
	/**
	 * Set the passwordHintAnswer
	 */	
	public void setPasswordHintAnswer(String aValue) {
		this.passwordHintAnswer = aValue;
	}	

    /**
     * return the note for current customer
     * @return
     */
    public String getNote() {
        return note;
    }
    /**
     * set not for current customer.
     * @param note
     */
    public void setNote(String note) {
        this.note = note;
    }
	/**
     * @see java.lang.Object#equals(Object)
     */
	public boolean equals(Object object) {
		if (!(object instanceof Customer)) {
			return false;
		}
		Customer rhs = (Customer) object;
		return new EqualsBuilder()
				.append(this.appuserId, rhs.appuserId)
						.append(this.passwordHint, rhs.passwordHint)
				.append(this.passwordHintAnswer, rhs.passwordHintAnswer)
				.append(this.version, rhs.version)
				.isEquals();
	}

	/**
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
		return new HashCodeBuilder(-82280557, -700257973)
				.append(this.appuserId) 
						.append(this.passwordHint) 
				.append(this.passwordHintAnswer) 
				.append(this.version) 
				.toHashCode();
	}

	/**
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return new ToStringBuilder(this)
				.append("customerId", this.appuserId) 
						.append("passwordHint", this.passwordHint) 
				.append("passwordHintAnswer", this.passwordHintAnswer) 
				.append("version", this.version) 
				.toString();
	}

	/**
	 * Return the name of the first key column
	 */
	public String getFirstKeyColumnName() {
		return "appuserId";
	}
	

	public String getCustomerCode() {
		return customerCode;
	}

	public void setCustomerCode(String customerCode) {
		this.customerCode = customerCode;
	}

	public String getTags() {
		return tags;
	}

	public void setTags(String tags) {
		this.tags = tags;
	}
	

	public String getRemoteIp() {
		return remoteIp;
	}

	public void setRemoteIp(String remoteIp) {
		this.remoteIp = remoteIp;
	}

	
	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public ShopPoint getShopPoint() {
		return shopPoint;
	}

	public void setShopPoint(ShopPoint shopPoint) {
		this.shopPoint = shopPoint;
	}
	
	public Integer getShopPointId() {
        return this.getShopPoint() == null ? null : this.getShopPoint().getShopPointId();
    }

    public void setShopPointId(Integer aValue) {
        if (aValue == null) {
        	shopPoint = null;
        } else {
        	shopPoint = new ShopPoint(aValue);
        	shopPoint.setVersion(Integer.valueOf(0));//set a version to cheat hibernate only
        }
    }

	public java.util.Set<CustomerAttrValue> getCustomerAttrValues() {
		return customerAttrValues;
	}

	public void setCustomerAttrValues(java.util.Set<CustomerAttrValue> customerAttrValues) {
		this.customerAttrValues = customerAttrValues;
	}
	

}